
package com.netease.xone.itemview;

import protocol.meta.InfoForward;
import Utils.TimeFormatUtil;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.netease.xone.R;
import com.netease.xone.view.ProfileView;
import com.netease.xone.widget.richtext.DiscussTextView;
import com.netease.xone.widget.richtext.IRichTextClickListener;

public class RenderDetailForwardView implements IRichTextClickListener {

    private ProfileView image;
    private TextView name;
    private TextView time;
    private DiscussTextView content;

    public RenderDetailForwardView(View v) {
        image = (ProfileView)v.findViewById(R.id.image);
        name = (TextView)v.findViewById(R.id.name);
        time = (TextView)v.findViewById(R.id.time);
        content = (DiscussTextView)v.findViewById(R.id.content);
        
        content.setRichTextClickListener(this);
    }

    public void renderView(final Context context, final InfoForward forward) {
        
        image.setImageUrl(forward.getUser().getUserAttr(), forward.getUser().getAvatar());
        name.setText(forward.getUser().getNickname());
        time.setText(TimeFormatUtil.getTimeFormat(context, forward.getTime()));
        content.setRichText(forward.getDigest());
    }

    @Override
    public boolean onRichTextClick(View view, String richTxt, int type) {
        
        return true;
    }
}
